1 module features.git;
2 import commons;
3 import feature;
4 
5 Feature GitFeature;
6 Task!loadSubmodules submoduleLoader;
7 
8 private void loadSubmodules(Feature*[] dependencies, ref Terminal t, ref RealTimeConsoleInput input)
9 {
10 	import std.process;
11 	t.writelnSuccess("Updating Git Submodules");
12 	t.flush;
13 	auto ret = executeShell("cd "~ configs["hipremeEnginePath"].str ~ " && " ~ getGitExec~" submodule update --init --recursive");
14 	if(ret.status)
15 		throw new Exception("Execution of git submodule update --init --recursive failed: \n"~ret.output);
16 }
17 
18 bool installGit(ref Terminal t, ref RealTimeConsoleInput input, 
19     TargetVersion ver,
20 Download[] downlloads)
21 {
22 	//aa
23 	version(Windows)
24 	{
25         string gitPath = buildNormalizedPath(std.file.getcwd(), "buildtools", "git");
26         configs["git"] = buildNormalizedPath(gitPath, "cmd");
27         updateConfigFile();
28 		return true;
29 	}
30 	else version(Posix)
31 	{
32 		t.writelnError("Please install Git to use hbuild.");
33 		return false;
34 	}
35 }
36 
37 void initialize()
38 {
39 	GitFeature = Feature(
40 		"git",
41 		"Git Versioning software",
42 		ExistenceChecker(["git"], ["git"]),
43 		Installation([
44 			Download(
45 				DownloadURL(
46 					windows: "https://github.com/git-for-windows/git/releases/download/v2.40.1.windows.1/MinGit-2.40.1-64-bit.zip",
47 					osx: "https://github.com/git-for-windows/git/releases/download/v2.40.1.windows.1/MinGit-2.40.1-64-bit.zip",
48 				),
49 				outputPath: "$TEMP$NAME"
50 			),
51 		], toDelegate(&installGit), ["$CWD/buildtools/git"]
52 	));
53 }
54 void start()
55 {
56 	submoduleLoader = Task!(loadSubmodules)([&GitFeature]);
57 }